﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:GeometryStylePicker="clr-namespace:DeepEarth.BingMapsToolkit.Client.Controls;assembly=DeepEarth.BingMapsToolkit.Client.Controls.GeometryStylePicker"
    xmlns:Digitizer="clr-namespace:DeepEarth.BingMapsToolkit.Client.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/DeepEarth.BingMapsToolkit.Client.Common;component/Resources/CommonStyles.xaml" />
    </ResourceDictionary.MergedDictionaries>
    
    <Style TargetType="Digitizer:Digitizer">
        <Setter Property="BorderBrush" Value="Black"/>
        <Setter Property="Background" Value="#FF2B2B2B"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Digitizer:Digitizer">
                    <Grid x:Name="LayoutRoot" Width="300" MinHeight="150" Opacity="0.82">
                        <Grid.Resources>
                            <DataTemplate x:Key="LayerDataTemplate">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Path=Tags}" />
                                    <TextBlock Text=" > " />
                                    <TextBlock Text="{Binding Path=LayerAlias}" />
                                </StackPanel>
                            </DataTemplate>
                            <DataTemplate x:Key="StyleDataTemplate">
                                <TextBlock Text="{Binding Path=Key}" TextWrapping="Wrap"/>
                            </DataTemplate>
                        </Grid.Resources>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:00.3000000"/>
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Normal">
                                    <Storyboard/>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="OperationStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:00.5000000"/>
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Draw">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.2500000" Storyboard.TargetName="MainContainer" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.1" Value="90"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.1" Storyboard.TargetName="DrawPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.1" Storyboard.TargetName="MetaDataPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.1" Storyboard.TargetName="StylePanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Style">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.2500000" Storyboard.TargetName="MainContainer" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.1" Value="-90"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.1" Storyboard.TargetName="DrawPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.1" Storyboard.TargetName="MetaDataPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.1" Storyboard.TargetName="StylePanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="MetaData">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.2500000" Storyboard.TargetName="MainContainer" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.1" Value="-90"/>
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.1" Storyboard.TargetName="DrawPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.1" Storyboard.TargetName="MetaDataPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00.1" Storyboard.TargetName="StylePanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Grid x:Name="MainContainer" Width="300" HorizontalAlignment="Center">
                            <Grid.Projection>
                                <PlaneProjection RotationY="0"></PlaneProjection>
                            </Grid.Projection>
                            <Border VerticalAlignment="Stretch" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="8,8,8,8" BorderThickness="2,2,2,2">
                                <ScrollViewer x:Name="PART_ScrollViewer" VerticalScrollBarVisibility="Auto" Style="{StaticResource ScrollViewerStyle}">
                                    <Grid>
                                        <StackPanel x:Name="DrawPanel" Visibility="Collapsed">
                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                                                <TextBlock Text="Digitiser" FontSize="16" Foreground="White" VerticalAlignment="Center"/>
                                                <Button x:Name="PART_New" Margin="5,5,5,5" ToolTipService.ToolTip="New" Style="{StaticResource ButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/New.png" Width="20" Stretch="Uniform"/>
                                                </Button>
                                                <Button x:Name="PART_Save" Margin="5,5,5,5" ToolTipService.ToolTip="Save" Style="{StaticResource ButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Save.png" Width="20" Stretch="Uniform"/>
                                                </Button>
                                                <Button x:Name="PART_Cancel" Margin="5,5,5,5" ToolTipService.ToolTip="Cancel" Style="{StaticResource ButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Delete.png" Width="20" Stretch="Uniform"/>
                                                </Button>
                                                <Button x:Name="PART_MetaData" Margin="5,5,5,5" ToolTipService.ToolTip="Edit MetaData" Style="{StaticResource ButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Info.png" Width="20" Stretch="Uniform"/>
                                                </Button>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="Digitise in: " Width="70" Foreground="White"/>
                                                <ComboBox x:Name="PART_Layers" Margin="0,0,0,0" Width="175" Height="20" ItemTemplate="{StaticResource LayerDataTemplate}"  Style="{StaticResource ComboBoxStyle}"/>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal" Height="28" HorizontalAlignment="Left" Margin="0,3,0,0">
                                                <TextBlock Text="Draw: " Width="70"  Foreground="White"/>
                                                <ToggleButton Visibility="Collapsed" x:Name="PART_FreeDrawToggleButton" ToolTipService.ToolTip="Free Draw" Style="{StaticResource ToggleButtonStyle}" >
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Draw.png" Stretch="Uniform"/>
                                                </ToggleButton>
                                                <ToggleButton x:Name="PART_LineStringToggleButton" ToolTipService.ToolTip="Draw Line" Style="{StaticResource ToggleButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Line.png" Stretch="Uniform"/>
                                                </ToggleButton>
                                                <ToggleButton x:Name="PART_PolygonToggleButton" ToolTipService.ToolTip="Draw Polygon" Style="{StaticResource ToggleButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Polygon.png" Stretch="Uniform"/>
                                                </ToggleButton>
                                                <ToggleButton x:Name="PART_PointPinToggleButton" ToolTipService.ToolTip="Add Point" Style="{StaticResource ToggleButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Pin.png" Stretch="Uniform"/>
                                                </ToggleButton>
                                                <ToggleButton x:Name="PART_EraserToggleButton" ToolTipService.ToolTip="Delete a shape" Style="{StaticResource ToggleButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Eraser.png" Stretch="Uniform"/>
                                                </ToggleButton>
                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="Style: " Width="70" Foreground="White"/>
                                                <ComboBox x:Name="PART_Styles" Margin="0,0,0,0" Width="175" Height="20" ItemTemplate="{StaticResource StyleDataTemplate}" Style="{StaticResource ComboBoxStyle}" />
                                                <Button x:Name="PART_NewStyle" ToolTipService.ToolTip="Create New Style" Style="{StaticResource ButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Add.png" Width="16" Stretch="Uniform"/>
                                                </Button>
                                            </StackPanel>
                                        </StackPanel>
                                        <StackPanel x:Name="MetaDataPanel" Visibility="Collapsed">
                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                                                <TextBlock Text="Meta Data" FontSize="16" Foreground="White" VerticalAlignment="Center"/>
                                                <Button x:Name="PART_MetaDataBack" Margin="5,5,5,5" ToolTipService.ToolTip="Back" Style="{StaticResource ButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Back.png" Width="20" Stretch="Uniform"/>
                                                </Button>
                                                <Button x:Name="PART_MetaDataSave" Margin="5,5,5,5" ToolTipService.ToolTip="Save" Style="{StaticResource ButtonStyle}">
                                                    <Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.Digitizer;component/Images/Save.png" Width="20" Stretch="Uniform"/>
                                                </Button>
                                            </StackPanel>
                                            <ContentPresenter x:Name="PART_AdditionalContent" Content="{TemplateBinding Content}" />
                                        </StackPanel>
                                        <StackPanel Orientation="Vertical" x:Name="StylePanel" Visibility="Collapsed">
                                            <GeometryStylePicker:GeometryStylePicker x:Name="PART_GeometryStylePicker" />
                                        </StackPanel>
                                    </Grid>
                                </ScrollViewer>
                            </Border>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

